home *** CD-ROM | disk | FTP | other *** search
- Path: seas.smu.edu!not-for-mail
- From: dbowman@post.smu.edu (Damon Bowman)
- Newsgroups: comp.lang.c++
- Subject: beginner question - constants
- Date: 3 Jan 1996 12:28:48 -0600
- Organization: Southern Methodist University
- Sender: usenet@seas.smu.edu
- Message-ID: <4ceht0$ruj@sun.cis.smu.edu>
- Reply-To: dbowman@post.smu.edu
- NNTP-Posting-Host: sun.cis.smu.edu
- X-Nntp-Posting-Host: ax4-10.ppp.smu.edu
- X-Newsreader: Forte Free Agent 1.0.82
-
-
- Can anyone explain to me the functional difference between a
- macro-based constant and a formal constant? I understand that by
- using the #define directive, the preprocessor replaces all instances
- of the constant in the code with itÆs value. I also understand that
- formal constants (using the const keyword) do not undergo this
- replacement.
-
- What I donÆt understand is why one might be better than another and
- what conditions might influence me to choose one over the other. They
- appear to be two versions of the same thing.
-
- Is it a speed issue? Intuitively, the macro-based constant seems like
- it would process faster. WhatÆs the tradeoff?
-
-
-